home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ghostscript.idb / usr / freeware / doc / ghostscript / 3.33 / xfonts.doc.z / xfonts.doc
Encoding:
Text File  |  1998-05-21  |  6.2 KB  |  159 lines

  1.    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of GNU Ghostscript.
  4.   
  5.   GNU Ghostscript is distributed in the hope that it will be useful, but
  6.   WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility to
  7.   anyone for the consequences of using it or for whether it serves any
  8.   particular purpose or works at all, unless he says so in writing.  Refer
  9.   to the GNU Ghostscript General Public License for full details.
  10.   
  11.  
  12. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  13.  
  14. This file, xfonts.doc, describes the interface between Ghostscript and the
  15. routines that access externally supplied font and text facilities.
  16.  
  17. For an overview of Ghostscript and a list of the documentation files, see
  18. README.
  19.  
  20. ********
  21. ******** Introduction ********
  22. ********
  23.  
  24. Starting with release 2.6, Ghostscript has the ability to use the
  25. character rasterizer provided by the underlying operating system and
  26. window system; specifically, Adobe Type Manager or a TrueType rasterizer
  27. under MS Windows, and the facilities provided by X Windows.  This ability
  28. augments, but does not replace, Ghostscript's own Type 1 rasterizer:
  29. Ghostscript may still use its own rasterizer for very large characters,
  30. characters that are clipped or transformed in unusual ways, and output to
  31. devices other than the screen.
  32.  
  33. Ghostscript interfaces to these platform facilities through a driver-like
  34. interface called the xfont (external font) interface.  Currently, xfont
  35. implementations are associated directly with device drivers; in a future
  36. release, Ghostscript may separate them, so that (for example) it will be
  37. possible to use the platform rasterizer when writing to a file.
  38.  
  39. Please note that beyond this point, this file is likely to be useful only
  40. to a small number of Ghostscript porters and implementors.
  41.  
  42. ********
  43. ******** Types ********
  44. ********
  45.  
  46. gs_char (defined in gsccode.h)
  47.  
  48.     This type represents a character code that appears in a string.
  49. Currently it is always a single byte, but composite fonts or Unicode may
  50. require it to be wider in the future.
  51.  
  52. gs_glyph (defined in gsccode.h)
  53.  
  54.     This type represents a character name like 'period' or 'epsilon'.
  55. From the xfont implementation's point of view, it is just a handle; when
  56. necessary, Ghostscript provides a gs_proc_glyph_name_t procedure (see next
  57. type) to convert it to a string name.
  58.  
  59. gs_proc_glyph_name_t (defined in gsccode.h)
  60.  
  61.     This type represents a procedure that maps a gs_glyph to its
  62. string name; see the description of char_glyph below.
  63.  
  64. gx_xglyph (defined in gsxfont.h)
  65.  
  66.     This type represents a character or glyph code that can be used
  67. with a specific platform font.  Normally it will be a character code that
  68. the implementation of render_char will turn into a 1-character string and
  69. give to the platform's "display string" operation.
  70.  
  71. gx_xfont_procs (declared in gsxfont.h, defined in gxxfont.h)
  72.  
  73.     This type is the xfont analogue of gx_device_procs, the type of
  74. the procedure record that defines an xfont implementation.
  75.  
  76. gx_xfont (declared in gsxfont.h, defined in gxxfont.h)
  77.  
  78.     This type is the gxfont analogue of gx_device, the type of the
  79. basic structure for an xfont.
  80.  
  81. (encoding_index)
  82.  
  83.     This is not really a type, although it probably should be: it is
  84. an int used to indicate the Encoding used by a font.  Defined values are
  85.     0 = StandardEncoding
  86.     1 = ISOLatin1Encoding
  87.     2 = SymbolEncoding
  88.     3 = DingbatsEncoding
  89.     -1 = other encoding
  90.  
  91. ********
  92. ******** Implementation procedures ********
  93. ********
  94.  
  95. All the procedures that return int results return 0 on success, or an
  96. appropriate negative error code in the case of error conditions.  The
  97. error codes are defined in gserrors.h.  The relevant ones are the same as
  98. for drivers (see drivers.doc for details).
  99.  
  100. As for drivers, if an implementation procedure returns an error, it
  101. should use the return_error macro rather than a simple return statement,
  102. e.g.,
  103.  
  104.     return_error(gs_error_VMerror);
  105.  
  106. This macro is defined in gx.h, which is automatically included by
  107. gdevprn.h but not by gserrors.h.
  108.  
  109. Font-level
  110. ----------
  111.  
  112. gx_xfont *(*lookup_font)(P7(gx_device *dev, const byte *fname, uint len,
  113.   int encoding_index, const gs_uid *puid, const gs_matrix *pmat,
  114.   const gs_memory_procs *mprocs))
  115.  
  116.     Look up a font name, UniqueID, and matrix, and return an xfont, or
  117. NULL if no suitable xfont exists.  Use mprocs to allocate the xfont and
  118. any subsidiary data structures.  The matrix is the FontMatrix concatenated
  119. with the CTM, so (roughly speaking) the font size in pixels is pmat->yy *
  120. 1000 for a normal Type 1 font.
  121.  
  122.     Note that this is the only implementation procedure that does not
  123. take an xfont * as its first argument.  In fact, callers of lookup_font
  124. must use the get_xfont_device driver procedure to get the correct device
  125. to pass as the first argument to lookup_font.
  126.  
  127. gx_xglyph (*char_xglyph)(P5(gx_xfont *xf, gs_char chr, int encoding_index,
  128.   gs_glyph glyph, gs_proc_glyph_name_t glyph_name))
  129.  
  130.     Convert a character name to an xglyph code.  In the case of
  131. glyphshow, chr may be gs_no_char; for an ordinary show operation, if
  132. the character code is invalid, glyph may be gs_no_glyph.
  133.  
  134. int (*char_metrics)(P5(gx_xfont *xf, gx_xglyph xg, int wmode,
  135.   gs_int_point *pwidth, gs_int_rect *pbbox))
  136.  
  137.     Get the metrics for a character.  If the metrics are unavailable,
  138. return 1.
  139.  
  140. int (*render_char)(P7(gx_xfont *xf, gx_xglyph xg, gx_device *target,
  141.   int x, int y, gx_color_index color, int required))
  142.  
  143.     Render a character.  (x,y) corresponds to the character origin.
  144. The target may be any Ghostscript device.  A good implementation will
  145. check whether the target can handle this type of xfont directly (e.g., by
  146. checking the target name), and if so, will render the character directly;
  147. otherwise, it will do what has to be done in the general case, namely, get
  148. a bitmap for the character and use the target's copy_mono operation.  If
  149. required is false, the procedure should return an error if the rendering
  150. operation would be expensive, since in this case Ghostscript has already
  151. cached the bitmap and metrics from a previous call with required=true.
  152. If the operation cannot be done, return 1.
  153.  
  154. int (*release)(P2(gx_xfont *xf, const gs_memory_procs *mprocs))
  155.  
  156.     Release any external resources associated with an xfont.  If
  157. mprocs is not NULL, also free any storage allocated by lookup_font
  158. (including the xfont itself).
  159.